export default function separator(num) {
  if (num) {
    const absNum = Math.abs(num)
    let numStr = absNum.toString().replace(/(^|\s)\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ','))
    numStr = num < 0 ? `-${numStr}` : numStr
    return numStr
  } else {
    return num
  }
}
